Attribute VB_Name = "Module_DrugGrp"
Function DrugGrpInsertMaster(v As VisM, ByVal Code As String, ByVal Desc As String) As Boolean
    v.P1 = Code
    v.P2 = Desc
    v.Execute "$$InsertMast^DHCSTDRUGGROUP(P1,P2)"
    If v.Error <> 0 Then
        DrugGrpInsertMaster = False
        Exit Function
    End If
    DrugGrpInsertMaster = True
End Function
Function DrugGrpUpdateMaster(v As VisM, ByVal id As String, ByVal Code As String, ByVal Desc As String) As Boolean
    v.P1 = id
    v.P2 = Code
    v.P3 = Desc
    v.Execute "$$UpdateMast^DHCSTDRUGGROUP(P1,P2,P3)"
    If v.Error <> 0 Then
        DrugGrpUpdateMaster = False
        Exit Function
    End If
    If v.Value = 1 Then
        DrugGrpUpdateMaster = True
    Else
        DrugGrpUpdateMaster = False
    End If
End Function
Function DrugGrpDelMaster(v As VisM, ByVal rid As String) As Boolean
    v.P1 = rid
    v.Execute "$$DeleteMast^DHCSTDRUGGROUP(P1)"
    If v.Error <> 0 Then
        DrugGrpDelMaster = False
        Exit Function
    End If
    
    DrugGrpDelMaster = True

End Function

Function DrugGrpGetRela(v As VisM, mrowid, ordcatdr) As Boolean
    v.P1 = mrowid
    v.P2 = ordcatdr
    Call Restore_Connect(v)
    v.Execute "$$GetRel^DHCSTDRUGGROUP(P1,P2)"
    If v.Error <> 0 Then
        MsgBox "error" + v.ErrorName
        DrugGrpGetRela = False
        Exit Function
    End If
    If v.Value = "1" Then
        DrugGrpGetRela = True
    Else
        DrugGrpGetRela = False
    End If
    
End Function
Function Get_DrugCatGrpRel(v As VisM, ByVal mrowid, ByVal ordcatrowid As String) As String
    v.P1 = mrowid
    v.P2 = ordcatrowid
    Call Restore_Connect(v)
    v.Execute "$$GetRel^DHCSTDRUGGROUP(P1,P2)"
    If v.Error <> 0 Then
        MsgBox "error"
        Exit Function
    End If
    Get_DrugCatGrpRel = v.Value
End Function
